SYMBOL,PRICE IBM,83.46 RHT,11.84 BA, 44.58 ORCL,17.37
This examples uses two data sources, a relational database and a text file. An H2 database is used here since it is Open Source, comes with JBoss AS and is light-weight. This section will describe how to setup the data sources in order to run the example. The example also uses a CSV file.
We need to create and deploy the required Connection Factories for HSQL database and File sources. Connection Factories are sources that provide the data when their data is integrated through Teiid. If you are familiar with creating data sources or connection factories in JBoss AS, then this is exactly the same operation
Perform the following steps to install and setup the data sources:
Edit the "<jboss-install>/standalone/configuration/standalone-teiid.xml" file and add contents of "<jboss-install>/docs/teiid/examples/dynamicvdb-portfolio/portfolio-ds.xml" file under "datasources" subsystem.
Use the File/Open Script menu option to view the "customer-schema.sql" script located in "<jboss-install>/docs/teiid/examples/dynamicvdb-portfolio". This file is automatically loaded and schema is created when the above data source is created.
In order to use a Text file as the source, we need a data file which defines the data in the table
Data File: Each data file contains column information for the table. The column information is typically defined on line 1 as header line in the file, and all the following lines contain the actual rows of data. Each single line corresponds to single row. A portion of the sample file is shown below. The complete sample file is "<jboss-install>/docs/teiid/examples/dynamicvdb-portfolio/data/marketdata-price.txt".
SYMBOL,PRICE IBM,83.46 RHT,11.84 BA, 44.58 ORCL,17.37
You can use the provide data files or create your own data files.
Edit the "<jboss-install>/standalone/configuration/standalone-teiid.xml" file and add contents of "<jboss-install>/docs/teiid/examples/dynamicvdb-portfolio/marketdata-file-ds.xml" file under "resource-adapters" subsystem.
At this point, both data sources are ready to access.
If the server has not been started, start it by executing
Windows:
cd <jboss-install>/bin standalone.bat -c standalone-teiid.xml
*nix:
cd <jboss-install>/bin ./standalone.sh -c standalone-teiid.xml